import entity.Player;
import entity.Ring;
import service.PrintService;
import entity.Print;
import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class test {
//    上机
      @Test
    public void testService(){
        ApplicationContext context = new ClassPathXmlApplicationContext("classpath:applicationContext.xml");
        Print print = (Print) context.getBean("printer2");
        PrintService printService = (PrintService) context.getBean("printService");
        printService.add(print);
    }
//    简答
    @Test
    public void testEquip() {
        ApplicationContext context = new ClassPathXmlApplicationContext("classpath:applicationContext.xml");
        Player player = (Player) context.getBean("player");
        Ring ring = (Ring) player.getRing();
        player.updateEquip(ring);
        System.out.println(player.getRing());
    }
}
